//
//  themeDetailsCell.m
//  UI_HLJ_Frame
//
//  Created by dlios on 15-7-3.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "themeDetailsCell.h"


#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation themeDetailsCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        //对imageView和label进行创建

        self.myImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
        
        self.mylabel = [[UILabel alloc]initWithFrame:CGRectZero];
        self.mylabel.numberOfLines=0;
        self.contentView.layer.cornerRadius=20;
        self.contentView.layer.masksToBounds=YES;
        self.contentView.backgroundColor=[UIColor whiteColor];
        
        [self.contentView addSubview:self.mylabel];
        [self.contentView addSubview:self.myImageView];
        [_myImageView release];
        
        UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
        button.frame = CGRectMake(10, 10, 40,40);
        [self.contentView addSubview:button];
//        button.backgroundColor = [UIColor redColor];
        if (self.isArchiver) {
            [button setImage:[UIImage imageNamed:@"tubiao1"] forState:UIControlStateNormal];
        } else{
            [button setImage:[UIImage imageNamed:@"tubiao2"] forState:UIControlStateNormal];
        }
        [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}



-(void)layoutSubviews
{   // 视图的位置
    self.myImageView.frame = CGRectMake(0, 0, WIDTH, self.contentView.frame.size.height-100);

    self.mylabel.frame = CGRectMake(0, HEIGHT / 1.35, 200, HEIGHT / 5.56);
        self.mylabel.font = [UIFont systemFontOfSize:15];
}

- (void)click:(UIButton *)button{
    
    [self.delegatey click:button];
    
}

@end
